package xyz.jcat.sca.example.lagou.resume.web.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.jcat.common.web.Resp;

@RefreshScope
@RestController
@RequestMapping("/nacos")
public class NacosTestController {

    @Value("${spring.cloud.nacos.discovery.cluster-name}")
    private String clusterName;

    @Value("${message}")
    private String message;
    @Value("${username}")
    private String username;
    @Value("${password}")
    private String password;


    @GetMapping("/cluster")
    public Resp getClusterName() {
        return Resp.ok(clusterName);
    }

    @GetMapping("/config")
    public Resp getNacosConfig() {
        return Resp.ok(message);
    }

    @GetMapping("/ext_config")
    public Resp getNacosExtConfig() {
        return Resp.ok(username+":"+password);
    }

}
